﻿<controls:MetroWindow xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                      xmlns:controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
                      xmlns:viewModels="clr-namespace:MultipleMonitorVideo.ViewModels"
                      xmlns:local="clr-namespace:MultipleMonitorVideo.Views"
                      xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
                      x:Class="MultipleMonitorVideo.Views.ControlPanelView"
                      Title="FIRST Robotics Control Panel" Width="1920" Height="1080"
                      WindowStartupLocation="Manual"
                      Closing="ControlPanelWindow_OnClosing">
    <controls:MetroWindow.DataContext>
        <viewModels:ControlPanelViewModel/>
    </controls:MetroWindow.DataContext>
    <Grid>
        <!-- Height is a hack -->
        <Grid Name="ModulesGrid" HorizontalAlignment="Center" Width="960" Height="960"
              VerticalAlignment="Top">
            <Grid.RowDefinitions>
                <RowDefinition Height="*" />
                <RowDefinition Height="*" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="320" />
                <ColumnDefinition Width="640" />
            </Grid.ColumnDefinitions>
            <local:DiagnosticsControlView Grid.Row="0" Grid.Column="0" x:Name="DiagnosticsControl" VerticalAlignment="Top"/>
            <!--<local:VideoControl Grid.Column="1" x:Name="VideoControl" VerticalAlignment="Top"/>
            <local:OverlayInfoControl Grid.Column="2" x:Name="OverlayInfoControl" VerticalAlignment="Top"/>-->
            <ItemsControl Grid.Row="0" Grid.Column="1" ItemsSource="{Binding ModuleManager.Modules}">
                <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="320" />
                                <ColumnDefinition Width="320" />
                            </Grid.ColumnDefinitions>
                        </Grid>
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <ContentControl Content="{Binding View}"/>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
                <ItemsControl.ItemContainerStyle>
                    <Style>
                        <Setter Property="Grid.Column" 
                                Value="{Binding ColumnIndex}" />
                    </Style>
                </ItemsControl.ItemContainerStyle>
            </ItemsControl>
        </Grid>
    </Grid>
    <i:Interaction.Triggers>
        <i:EventTrigger EventName="Closing">
            
        </i:EventTrigger>
    </i:Interaction.Triggers>
    <!--<Window.InputBindings>
        <KeyBinding Key="Escape" Command="{Binding CloseAllWindowsCommand}"></KeyBinding>
    </Window.InputBindings>-->
</controls:MetroWindow>
